package cz.schovjan.proj.model;

import java.io.Serializable;
import java.util.Date;

import cz.schovjan.proj.model.Constants.Roles;


/**
 * Model prihlaseneho uzivatele.
 * @author schovjan
 * 
 */
public class User implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String nick;
	private String name;
	private String surname;
	private String password;
	private String sign;
	private Date dateCreate;
	private String email;
	private Roles role;
	
	
	public User() {
	}
	
	public User(String nick, String name, String surname,
			String password, String sign, Date dateCreate, String email, Roles role) {
		this.nick = nick;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.sign = sign;
		this.dateCreate = dateCreate;
		this.email = email;
		this.role = role;
	}

	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public Date getDateCreate() {
		return dateCreate;
	}

	public void setDateCreate(Date dateCreate) {
		this.dateCreate = dateCreate;
	}

	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public Roles getRole() {
		return role;
	}

	public void setRole(Roles role) {
		this.role = role;
	}
	
	public boolean isRoleUser() {
		if (this.role == Roles.USER) {
			return true;
		}
		
		return false;
	}
	
	public boolean isRoleAdmin() {
		if (this.role == Roles.ADMIN) {
			return true;
		}
		
		return false;
	}
	
	@Override
	public String toString() {
		return "User [nick=" + nick + ", name=" + name + ", surname=" + surname
				+ ", password=" + password + ", sign=" + sign + ", dateCreate="
				+ dateCreate + ", email=" + email + ", role=" + role + "]";
	}
	
}
